------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\priorauth_patlevel.log
  log type:  text
 opened on:  12 Jul 2024, 14:41:33

. 
. /*******************************************************************************
> priorauth_patlevel.do
> 
> Conducts analysis of prior authorization at the patient panel
> *******************************************************************************/
. 
. clear all

. 
. qui     use ${cleandatapath}patientlevel.dta if year>=2011, clear

. 
. qui {

. 
. su pre_totalridemo if pre_totalridemo>0 & pat_flag==1, d // Referenced in Section 5.3, Paragraph 4

                       pre_totalridemo
-------------------------------------------------------------
      Percentiles      Smallest
 1%            1              1
 5%            1              1
10%            1              1       Obs               9,204
25%            2              1       Sum of wgt.       9,204

50%            6                      Mean           8.680356
                        Largest       Std. dev.      7.696286
75%           14             24
90%           23             24       Variance       59.23282
95%           24             24       Skewness       .8098642
99%           24             24       Kurtosis        2.28808

. su post_totalridemo if post_totalridemo>0 & pat_flag==1, d // Referenced in Section 5.3, Paragraph 4

                      post_totalridemo
-------------------------------------------------------------
      Percentiles      Smallest
 1%            1              1
 5%            1              1
10%            1              1       Obs               4,227
25%            1              1       Sum of wgt.       4,227

50%            3                      Mean           6.257393
                        Largest       Std. dev.      6.806395
75%            9             24
90%           19             24       Variance       46.32701
95%           23             24       Skewness       1.408316
99%           24             24       Kurtosis       3.802586

. 
. twoway (hist pre_totalrides if pre_totalridemo>0, ///
>                 width(20) start(-0.00001)) ///
>         (hist post_totalrides if post_totalridemo>0, ///
>                 width(20) start(-0.00001) fcolor(none) lcolor(black)) if pat_flag==1, ///
>         xti("") yti(Empirical Probability Density) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(subti("Total Rides in the...") order(1 "Pre-Period" 2 "Post-Period"))

. qui graph export "${outpath}Figure_8a.pdf", as(pdf) replace // Figure 8a

. 
. twoway (hist pre_totalridemo if pre_totalridemo>0, ///
>                 width(0.99999) start(0.99999)) ///
>         (hist post_totalridemo if post_totalridemo>0, ///
>                 width(0.99999) start(0.99999) fcolor(none) lcolor(black)) if pat_flag==1, ///
>         xti("") yti(Empirical Probability Mass) ///
>         graphregion(color(white)) bgcolor(white) ///
>         leg(subti("Total Months Riding in the...") order(1 "Pre-Period" 2 "Post-Period"))

. qui graph export "${outpath}Figure_8b.pdf", as(pdf) replace // Figure 8b

. 
. qui {
no observations
no observations

. 
. di (-0.0256-1.96*0.0191)/12.12 // Referenced in Section 5.2, Paragraph 3
-.00520099

. 
. qui {

. 
. *Figures 9, A11b
. foreach var in rider_ridesnext rider_hosp rider_death NEdialysisrides {
  2.     local varlabel : variable label `var'
  3.         estimates clear
  4.         qui eststo: reghdfe `var' ib99.months_since $pat_controls $fac_controls, a(t dist_code newprovusrd) vce(cluster dist_code)
  5.         qui estimates save ${estpath}priorauth_`var'_noparboth_wFE,replace
  6.         coefplot, recast(connected) ciopts(recast(rcap)) baselevel ///
>                 keep(*months_since) drop(50*) vert ///
>                 xline(13, lcolor(gs8) lpattern(dash)) ///
>                 xti(Months Since Prior Authorization) ///
>                 xlab(1 "-12" 4 "-9" 7 "-6" 10 "-3" 13 "0" 16 "3" 19 "6" 22 "9" 25 "12") ///
>                 yline(0, lcolor(gs8)) ///
>                 yti("`varlabel'") ylab(, angle(0)) ///
>                 graphregion(color(white)) bgcolor(white)
  7.         if "`var'"=="rider_ridesnext" {
  8.                 qui graph export "${outpath}Figure_9a.pdf", as(pdf) replace
  9.         }
 10.         if "`var'"=="rider_hosp" {
 11.                 qui graph export "${outpath}Figure_9b.pdf", as(pdf) replace
 12.         }
 13.         if "`var'"=="rider_death" {
 14.                 qui graph export "${outpath}Figure_9c.pdf", as(pdf) replace
 15.         }
 16.         if "`var'"=="NEdialysisrides" {
 17.                 qui graph export "${outpath}Figure_A11b.pdf", as(pdf) replace
 18.         }
 19. }

. 
. log close
      name:  <unnamed>
       log:  X:\shared\ambulance\Work\replicationpackage\logs\priorauth_patlevel.log
  log type:  text
 closed on:  13 Jul 2024, 07:39:48
--------------------------------------------------------------------------------------------------------------------------------------------------------
